function getBusinessFromCity(){
	
	if($("#Name_firstleaveCity").val()=="" || "中文/拼音"==$("#Name_firstleaveCity").val() || "全拼/简拼/汉字"==$("#Name_firstleaveCity").val()){
		$("#firstleaveCity").val("");
	}
	var cityid=$("#firstleaveCity").val();
	$.ajax({  
		url : "hotel/selectCityArea.do?op=getBusinessList",  
		data:{cityCode : cityid},
		type : "post",  
		cache : true,  
		dataType : "json",  //返回json数据
		error: function(){
		$("#business_Id").html("");
		$("#Name_firstleaveCity").addClass("onFormError");
		$("#errorMessageCity").css({"display": ""});
  					var str="<p>您选择的城市没有商圈。</p><div class=\"inArr\"></div>";
  					$("#errorContentCity").html(str);
		},
		success: onchangecallback4businesscircle
	});
	
}
function onchangecallback4businesscircle(data){
		$("#business_Id").html("");
		var business="";
		var datalength=0;
		if(data!=null){
		if(data.length>0){
		$("#errorMessageCity").css({"display": "none"});
		if(data.length>3){
		datalength=3;
		}else{
		datalength=data.length;
		}
		for(var i=0;i<datalength;i++){
		if(data[i].busName.length>14){
		business+="<dd><input name=\"business\" class=\"chemore\" type=\"checkbox\" id=\"businessId"+i+"\" value=\""+data[i].busCode+"\" onclick=\"javascript:checkSelectCount();\" /><span title=\""+data[i].busName+"\">"+data[i].busName.substr(0,14)+"..</span></dd>";
		}else{
		business+="<dd><input name=\"business\" class=\"chemore\" type=\"checkbox\" id=\"businessId"+i+"\" value=\""+data[i].busCode+"\"  onclick=\"javascript:checkSelectCount();\"/><span>"+data[i].busName+"</span></dd>";
		}
		}
		business+="<dd><a href=\"javascript:void(0)\" class=\"chemore\">更多商圈</a></dd>";
          business+="<div class=\"filtermore\">";
              business+="<div class=\"taghot\">";
                business+="<div class=\"current\" id=\"sQuan\">商业圈</div>";
                
             business+="</div>";
              business+="<div class=\"filtecolse\"><a title=\"关闭\" href=\"javascript:void(0)\" class=\"colseche\">关闭</a></div>";
              business+="<div class=\"checklist sQuan block\">";
                business+="<ul>";
	              for(var i=0;i<data.length;i++){
	              business+="<li>";
                    business+="<input id=\"businessinfo"+i+"\" type=\"checkbox\" value=\""+data[i].busCode+"\" name=\"businessinfo\" onclick=\"javascript:checkSelectCount();\"/>";
                    business+="<label title=\""+data[i].busName+"\">"+data[i].busName+"</label>";
                  business+="</li>";
                 }
                business+="</ul>";
                business+="<form id=\"form5\" name=\"form5\" action=\"hotel/loadHotels.do\" method=\"get\">";
                business+="<input name=\"op\" value=\"baseHotels\" type=\"hidden\" />"
                business+="<div class=\"sour\">";
            	var firstleaveCity=$("#firstleaveCity").val();
            	var Name_firstleaveCity=$("#Name_firstleaveCity").val();
            	var startdate = $("#date").val();
            	var enddate = $("#enddate").val();
            	var pricevalue = $("#pricevalue").val();
                business+="<input type=\"hidden\" id=\"firstleaveCityName\" name=\"firstleaveCityName\" value=\""+firstleaveCity+"\"/>";
                business+="<input type=\"hidden\" id=\"Name_firstleaveCity\" name=\"Name_firstleaveCityName\" value=\""+Name_firstleaveCity+"\"/>";
                business+="<input type=\"hidden\" id=\"date2\" name=\"date2\" value=\""+startdate+"\"/>";
                business+="<input type=\"hidden\" id=\"enddate2\" name=\"enddate2\" value=\""+enddate+"\"/>";
                business+="<input type=\"hidden\" id=\"pricevalue\" name=\"pricevalue\" value=\""+pricevalue+"\"/>";
                business+="<input type=\"hidden\" name=\"businessvalue\" id=\"businessvalue\" value=\"\" />";
                business+="<input type=\"button\" name=\"businessSubmit\" onclick=\"javascript:addBusiness();\" class=\"searchform\" value=\"按商圈查询\" />";
                business+="</div>";
                business+="</form>";
              business+="</div>";
            business+="</div>";
            
            business+="<script type=\"text/javascript\">";
            business+="$(\".taghot li:first\").addClass(\"current\");";
			business+="$(\".taghot li\").click(function(){";
			business+="$(\".taghot li\").removeClass(\"current\");";
			business+="$(this).addClass(\"current\");";
			business+="$(\".checklist\").hide();";
			business+="$(\".\"+ $(this).attr(\"id\")).show();";
			business+="});";
            
            business+="$(\".colseche\").click(function(){";
	 		business+="var tempObject=document.getElementsByName(\"business\");";
			business+="var tempSize=tempObject.length;";
			business+="for (i=0; i<tempSize; i++)";
    		business+="{";
        	business+="if (tempObject[i].checked == true) {";
        	business+="document.getElementById(\"businessId\"+i).checked=false;";
	        business+="}";
   			business+="}";
   			business+="var tempObject_info=document.getElementsByName(\"businessinfo\");";
			business+="var tempSize_info=tempObject_info.length;";
			business+="for (i=0; i<tempSize_info; i++)";
    		business+="{";
        	business+="document.getElementById(\"businessinfo\"+i).checked=false;";
        	business+="document.getElementById(\"businessinfo\"+i).disabled=false;";
        	business+="}";
   			business+="var tempObject_zone=document.getElementsByName(\"zoneinfo\");";
			business+="var tempSize_zone=tempObject_zone.length;";
			business+="for (i=0; i<tempSize_zone; i++)";
    		business+="{";
        	business+="document.getElementById(\"zoneinfo\"+i).checked=false;";
        	business+="document.getElementById(\"zoneinfo\"+i).disabled=false;";
        	business+="}";
        	business+="$(\".filtermore\").hide();";
	 		business+="});";
		 	business+="$(\".chemore\").click(function(){";
		 	business+="var tempObject=document.getElementsByName(\"business\");";
			business+="var tempSize=tempObject.length;";
			business+="var chestr=\"\";";
			business+="for (i=0; i<tempSize; i++)";
    		business+="{";
        	business+="if (tempObject[i].checked == true) {";
        	business+="document.getElementById(\"businessinfo\"+i).checked=true;";
        	business+="chestr+=tempObject[i].value+\",\";";
        	business+="$('#businessvalue').val(chestr.substring(0,chestr.length-1));";
        	business+="}else{";
       		business+="document.getElementById(\"businessinfo\"+i).checked=false;";
        	business+="}";
   			business+="}";
		 	business+="$(\".filtermore\").show();";
	 		business+="});";
	 		
       		business+="function checkSelectCount(){";
			business+="var tempCount=0;";
			business+="var tempObject=$(\"input[name=businessinfo]\");";
			business+="var tempSize=tempObject.length;";
			business+="var chestr=\"\";";
			business+="for (i=0; i<tempSize; i++)";
    		business+="{";
	        business+="if (tempObject[i].checked == true) {";
        	business+="tempCount = tempCount+1;";
        	business+="chestr+=tempObject[i].value; ";
        	business+="if(i!=(tempSize-1)){chestr+=\",\";}"
        	business+="}";
	   		business+="}";
   			business+="if(tempCount>2){";
   			business+="for(i=0;i<tempSize;i++){";
   			business+="if(tempObject[i].checked!=true){";
   			business+="tempObject[i].disabled=true;";
   			business+="}";
   			business+="}";
        	business+="}else{";
        	business+="for(i=0;i<tempSize;i++){";
   			business+="tempObject[i].disabled=false;";
   			business+="}";
        	business+="}";
        	business+="if($.trim(chestr)!=''){";
        	business+="$('#businessvalue').val(chestr.substring(0,chestr.length-1));";
        	business+="}";
        	business+="$(\"#zonevalue\").val(\"-1\");";
			business+="}";
       		
       		business+="function addBusiness(){";
//       		business+="saveCitytoCookie();";
       		business+="$(\"#form5\").submit(); ";
       		business+="}";
       		
       		
       		business+="</script>";
       		
		}else{
		business+="<dd>您选择的城市没有商圈。</dd>";
		}
		}else{
		business+="<dd>您选择的城市没有商圈。</dd>";
		}
		
		$("#business_Id").html(business);
}
function closeHighSelect(){
if('全拼/简拼/汉字'==$("#Name_firstleaveCity").val() || '中文/拼音'==$("#Name_firstleaveCity").val() ){
$("#Name_firstleaveCity").val("");
}
$("#highSelect").text("高级查询选项▼");
$("#highSelectList").hide();
$("#Name_firstleaveCity").removeClass("onFormError");
$("#errorMessageCity").css({"display": "none"});
}
function setNull(){
if(''==$("#Name_firstleaveCity").val()){

}
}

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }

        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
  function saveCitytoCookie(){
       var options = { expires: 10, path: '/' };
       $.cookie('Name_firstleaveCity', null);
       $.cookie('firstleaveCity', null);
       $.cookie('Name_firstleaveCity', $('#Name_firstleaveCity').val(),options);
       $.cookie('firstleaveCity', $('#firstleaveCity').val(),options);
  }
 